package com.chenxiao.datasource2.controller;

import com.alibaba.druid.support.json.JSONUtils;
import com.chenxiao.datasource.mainsource.utils.AjaxResult;
import com.chenxiao.datasource.othersource.entity.Log;
import com.chenxiao.datasource2.service.RoleService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author: CX
 * @Date: Created in  2023/12/06 22:50
 * @version: v1.0
 * @Description: TODO
 **/
@RestController
public class RoleController {
    @Resource
    private RoleService roleService;
    @GetMapping("/role/{id}")
    public AjaxResult getUserById(@PathVariable Long id){
        return new AjaxResult("200", roleService.selectByPrimaryKey(id));
    }
    @PostMapping("/sendLogs")
    public AjaxResult sendLogs(@RequestBody Log log, @RequestHeader Map<String, String> headers){
        return new AjaxResult("200", JSONUtils.toJSONString(log));
    }

}
